<template>
  <div class="about">
   <el-form :model="ruleForm" status-icon ref="ruleForm" label-width="100px" class="demo-ruleForm">

     
  <el-form-item label="用户名" prop="pass">
    <el-input type="text" v-model="ruleForm.username" ></el-input>
  </el-form-item>

  <el-form-item label="密码" prop="checkPass">
    <el-input type="password" v-model="ruleForm.password" ></el-input>
  </el-form-item>


  <el-form-item>
    <el-button type="primary" @click="sub(ruleForm)">登录</el-button>
    <el-button @click="resetForm('ruleForm')">注册</el-button>
  </el-form-item>
</el-form>
  </div>
</template>

<script>
import axios from "../axios/index"
import {mapState,mapMutations,mapActions} from "vuex"
  export default {
    data() {
     
      return {
        ruleForm: {
          username: '',
          password: ''
          
        }
      };
    },
    methods: {
      ...mapActions(["Login"]),
      sub(ruleForm) {
        
        this.Login(ruleForm).then(res=>{
          this.$router.push("/first")
        })
       
      },
      resetForm(formName) {
        this.$refs[formName].resetFields();
      }
    }
  }
</script>